package camel.first.api.datastore.internal.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * User: yuxinlei
 * Date: 4/13/11
 * Time: 1:51 PM
 */
@javax.persistence.Table(name = "builds", catalog = "reportdb")
@Entity
public class BuildsEntity {
    private int id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private int buildNum;

    @javax.persistence.Column(name = "build_num", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getBuildNum() {
        return buildNum;
    }

    public void setBuildNum(int buildNum) {
        this.buildNum = buildNum;
    }

    private String causeAction;

    @javax.persistence.Column(name = "cause_action", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
    @Basic
    public String getCauseAction() {
        return causeAction;
    }

    public void setCauseAction(String causeAction) {
        this.causeAction = causeAction;
    }

    private String author;

    @javax.persistence.Column(name = "author", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
    @Basic
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    private String result;

    @javax.persistence.Column(name = "result", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    private int duration;

    @javax.persistence.Column(name = "duration", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    private String buildOn;

    @javax.persistence.Column(name = "build_on", nullable = true, insertable = true, updatable = true, length = 256, precision = 0)
    @Basic
    public String getBuildOn() {
        return buildOn;
    }

    public void setBuildOn(String buildOn) {
        this.buildOn = buildOn;
    }

    private int failcount;

    @javax.persistence.Column(name = "failCount", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getFailcount() {
        return failcount;
    }

    public void setFailcount(int failcount) {
        this.failcount = failcount;
    }

    private int skipcount;

    @javax.persistence.Column(name = "skipCount", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getSkipcount() {
        return skipcount;
    }

    public void setSkipcount(int skipcount) {
        this.skipcount = skipcount;
    }

    private int totalcount;

    @javax.persistence.Column(name = "totalCount", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getTotalcount() {
        return totalcount;
    }

    public void setTotalcount(int totalcount) {
        this.totalcount = totalcount;
    }

    private Timestamp buildDate;

    @javax.persistence.Column(name = "build_date", nullable = true, insertable = true, updatable = true, length = 19, precision = 0)
    @Basic
    public Timestamp getBuildDate() {
        return buildDate;
    }

    public void setBuildDate(Timestamp buildDate) {
        this.buildDate = buildDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BuildsEntity that = (BuildsEntity) o;

        if (buildNum != that.buildNum) return false;
        if (duration != that.duration) return false;
        if (failcount != that.failcount) return false;
        if (id != that.id) return false;
        if (skipcount != that.skipcount) return false;
        if (totalcount != that.totalcount) return false;
        if (author != null ? !author.equals(that.author) : that.author != null) return false;
        if (buildDate != null ? !buildDate.equals(that.buildDate) : that.buildDate != null) return false;
        if (buildOn != null ? !buildOn.equals(that.buildOn) : that.buildOn != null) return false;
        if (causeAction != null ? !causeAction.equals(that.causeAction) : that.causeAction != null) return false;
        if (result != null ? !result.equals(that.result) : that.result != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result1 = id;
        result1 = 31 * result1 + buildNum;
        result1 = 31 * result1 + (causeAction != null ? causeAction.hashCode() : 0);
        result1 = 31 * result1 + (author != null ? author.hashCode() : 0);
        result1 = 31 * result1 + (result != null ? result.hashCode() : 0);
        result1 = 31 * result1 + duration;
        result1 = 31 * result1 + (buildOn != null ? buildOn.hashCode() : 0);
        result1 = 31 * result1 + failcount;
        result1 = 31 * result1 + skipcount;
        result1 = 31 * result1 + totalcount;
        result1 = 31 * result1 + (buildDate != null ? buildDate.hashCode() : 0);
        return result1;
    }

    private ProjectsEntity projectsByProjectId;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "project_id", referencedColumnName = "id")
    ProjectsEntity getProjectsByProjectId() {
        return projectsByProjectId;
    }

    public void setProjectsByProjectId(ProjectsEntity projectsByProjectId) {
        this.projectsByProjectId = projectsByProjectId;
    }

    private CoverageEntity coverageById;

    @OneToOne(mappedBy = "buildsByBuildId")
    public CoverageEntity getCoverageById() {
        return coverageById;
    }

    public void setCoverageById(CoverageEntity coverageById) {
        this.coverageById = coverageById;
    }


}
